package myutil;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpTest
{
    public static void main(String[] args)
    {
        try
        {
            //定义目标地址
            String url = "http://localhost:8089/face_web_war_exploded/ajax";
            //构建一个URL对象
           URL httUrl = new  URL(url);
            //发起请求
            HttpURLConnection con = (HttpURLConnection) httUrl.openConnection();
            con.setRequestProperty("appKey"+"123"+"ASD","123");
            InputStream inputStream = con.getInputStream();
            //获取响应body
            BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
            String line;
            String result = "";
            while ((line = in.readLine()) != null){
                result += line;
            }
            System.out.println(result);
        }catch (Exception e)
        {
            e.printStackTrace();
        }

    }
}
